Skip to content

Conversation

@ThePassionate
Copy link
Contributor

Benchmarks: Add Whetstone FPU Benchmark with Enhanced Timing

Summary

This PR adds the Whetstone floating-point benchmark to NuttX applications. The Whetstone benchmark is a widely-used tool for evaluating FPU (floating-point unit) performance. The implementation includes timing enhancements that provide millisecond-level precision for more accurate performance measurement.

Changes

Files Added

  1. benchmarks/whetstone/CMakeLists.txt

    • CMake build configuration for Whetstone benchmark
  2. benchmarks/whetstone/Kconfig

    • Kconfig menu options for benchmark configuration
  3. benchmarks/whetstone/Make.defs

    • Make definitions for the benchmark module
  4. benchmarks/whetstone/Makefile

    • Makefile for standalone compilation
  5. benchmarks/whetstone/whetstone.c

    • Whetstone benchmark implementation ported and adapted for NuttX

Technical Details

Whetstone Benchmark:

Timing Precision Enhancement:

  • Original implementation used seconds-level timing (time(0))
  • Enhanced to use millisecond-level precision for better accuracy
  • Enables more precise measurement of short test cycles
  • Critical for accurate FPU performance evaluation on faster processors

Benefits:

  • Millisecond precision allows measurement of test cycles completing in less than 1 second
  • Better accuracy on modern high-performance systems
  • Maintains compatibility with standard Whetstone benchmark methodology

Impact

  • Performance Evaluation: Provides standard FPU benchmark for NuttX systems
  • Measurement Accuracy: Millisecond-level timing improves result precision
  • Portability: Maintains standard Whetstone benchmark characteristics
  • Integration: Seamlessly integrated into NuttX build system

Usage

Enable benchmark with:
CONFIG_BENCHMARKS_WHETSTONE=y

Testing

Benchmark functionality verified on various systems with FPU support.

nsh> whetstone 100000 Loops: 100000, Iterations: 1, Duration: 5 sec.
C Converted Double Precision Whetstones: 2.00 MWIPS


Author: makejian [email protected]

Copy link
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThePassionate please add a Documentation about this new app.

Copy link
Member

@raiden00pl raiden00pl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this licence? Is it even Apache compatible? we need to add license guard to this code

@raiden00pl
Copy link
Member

It's some kind of custom license, I think we should add "ALLOW_CUSTOM_COMPONENTS" or something like that for such strange cases

@ThePassionate
Copy link
Contributor Author

@ThePassionate please add a Documentation about this new app.

Thanks! I have updated a README about testing module and how to test.

@ThePassionate
Copy link
Contributor Author

It's some kind of custom license, I think we should add "ALLOW_CUSTOM_COMPONENTS" or something like that for such strange cases

I update Apache-2.0 License for Nuttx and add reference from source file

@raiden00pl
Copy link
Member

raiden00pl commented Jan 19, 2026

@ThePassionate You can't relicense this file. This license doesn't appear to be compatible with Apache.

EDIT: the license must remain as it was and the compilation must be guarded by depends on ALLOW_xxx_COMPONENTS

Also nuttx doesn't use README anymore, please move this to nuttx/Documentation

@acassis
Copy link
Contributor

acassis commented Jan 19, 2026

@ThePassionate please add a Documentation about this new app.

Thanks! I have updated a README about testing module and how to test.

@ThePassionate we deprecated README files some years ago, all Documentation for nuttx and nuttx-apps should be created as ReStructuredText at nuttx/Documentation/

Please move it to there

Copy link
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThePassionate
Copy link
Contributor Author

@ThePassionate please create the Documentation file at https://nuttx.apache.org/docs/latest/applications/benchmarks/index.html

Thanks! I didn't know the document path was in the Nuttx repository. I was searching in the current directory and only wrote the README because I couldn't find a suitable path. Thank you for your patience!

@ThePassionate
Copy link
Contributor Author

@ThePassionate You can't relicense this file. This license doesn't appear to be compatible with Apache.

EDIT: the license must remain as it was and the compilation must be guarded by depends on ALLOW_xxx_COMPONENTS

Also nuttx doesn't use README anymore, please move this to nuttx/Documentation

so should I add this license KCONFIG in this patch? it looks good to me.

@ThePassionate
Copy link
Contributor Author

@ThePassionate You can't relicense this file. This license doesn't appear to be compatible with Apache.

EDIT: the license must remain as it was and the compilation must be guarded by depends on ALLOW_xxx_COMPONENTS

Also nuttx doesn't use README anymore, please move this to nuttx/Documentation

I get it ! Let me try

@ThePassionate
Copy link
Contributor Author

Kconfig: Add ALLOW_PROPRIETARY_COMPONENTS option apache/nuttx#18017

please review apache/nuttx#18017 @acassis @raiden00pl Thanks!

@acassis
Copy link
Contributor

acassis commented Jan 19, 2026

@jerpelea seems like there is not an official SPDX definition for Whetstone benchmark, how can I suggest this license to them:

SPDX-License-Identifier: LicenseRef-Painter-Engineering-Whetstone

Copy link
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThePassionate please remove README.md from PR

Add the Whetstone floating-point benchmark to NuttX applications.
The Whetstone benchmark is a widely-used tool for evaluating FPU
(floating-point unit) performance.

This benchmark is ported from netlib.org whetstone.c which has a
custom permissive license requiring attribution. Therefore it
depends on ALLOW_CUSTOM_PERMISSIVE_COMPONENTS.

Usage: whetstone [loops]

Signed-off-by: makejian <[email protected]>
Change FPU benchmark timing from seconds to milliseconds for better accuracy.
This allows for more precise measurement of test cycles, especially for
shorter test runs that previously completed within a single second.

Signed-off-by: makejian <[email protected]>
@ThePassionate ThePassionate force-pushed the benchmarks-fpu-whetstone branch from e2b3f3c to 7bc83a5 Compare January 20, 2026 02:38
@ThePassionate
Copy link
Contributor Author

@ThePassionate please remove README.md from PR

Done. Thanks again!

@xiaoxiang781216
Copy link
Contributor

@ThePassionate please rebase your change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants